Memory leak fix: release badchars member directly because currently setshort_badchars...
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 10 Jan 2006 22:22:49 +0000 (22:22 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 10 Jan 2006 22:22:49 +0000 (22:22 +0000)
gpsbabel/mkshort.c

index cba30f3e42bd0dcbf3b5262339013a46c60c8b0e..d0938b134364936b939f59e2540c26837d88803a 100644 (file)
@@ -172,7 +172,10 @@ mkshort_del_handle(short_handle *h)
                        xfree(s);
                }
        }
-       setshort_badchars(*h, NULL);
+       /* setshort_badchars(*h, NULL); ! currently setshort_badchars() always allocates something ! */
+       if (hdr->badchars != NULL) {
+               xfree(hdr->badchars);
+       }
        setshort_goodchars(*h, NULL);
        if (hdr->defname) {
                xfree(hdr->defname);